package com.example.service.impl;

import com.example.dao.UserMapper;
import com.example.domain.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by xiaoyuan on 2017/9/26.
 */
@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional(readOnly = false)
    public int add(User user) {
        return userMapper.add(user);
    }

    @Override
    @Transactional(readOnly = false)
    public int update(User user) {
        return userMapper.update(user);
    }

    @Override
    @Transactional(readOnly = true)
    public List<User> queryUserById(Long id) {
        return userMapper.queryUserById(id);
    }

    @Override
    @Transactional(readOnly = false)
    public int deleteByIds(String[] ids) {
        return userMapper.deleteByIds(ids);
    }


    @Override
    @Transactional(readOnly = true)
    public List<User> queryLearnResouceList(Map<String, Object> params) {
        return userMapper.queryUserList(params);
    }
}
